<!DOCTYPE html>
<uieip type="page" value="login" debug="true" timeout="5000"></uieip>
<uieip type="reg" value="console,model"></uieip>
<html>

<head>
    <uieip type="file" value="inc" src="/yqwin/easyui/include.txt" cache="true" minute="1440"></uieip>
    <uieip type="file" value="css" src="/yqwin/css/yqwin.min" cache="false"></uieip>
    <uieip type="file" value="js" src="/yqwin/src/yqwin.min" cache="false"></uieip>
    <script src="/yqwin/src/yq.flowview.js"></script>
    <uieip type="tmpl" value="model.title"></uieip>
</head>

<body>
    <table id="tb" style="width:100%;height: 350px;"></table>
    <script>
        <uieip type="tmpl" value="model.params"></uieip>
        $(function () {
            main_fun.init();
        });

        var page_fun = {
            init: function () {
                $(window).resize(function () {
                    page_fun.onresize();
                });
                page_fun.onresize();

                main_fun.seek();
            },
            onresize: function () {
                var w = window.innerWidth;
                var h = window.innerHeight;

                if (w < 100) {
                    w = 100;
                }
                if (h < 100) {
                    h = 100;
                }

                main_fun.resize({
                    width: w,
                    height: h
                });
            }
        }

        var main_fun = {
            id: "tb",
            init: function () {
                var opts = $.extend(_tb, {
                    linkField: ["textbox"],
                    loadData: false,
                    afterBindingTitle: function () {
                        page_fun.init();
                    },
                    onBeforeShowEdit: function (titles, action, row, callback) {      //add/upp/move 编辑执行前
                        if (action == 'add') {
                            row["state"] = 0;
                            row["wflock"] = false;
                        }
                        console.log("onBeforeShowEdit", titles, action, row);
                        callback(true, titles, row);      //true 执行编辑
                    },
                });
                $("#" + main_fun.id).yqDataGrid(opts);
            },
            resize: function (size) {
                $("#" + main_fun.id).yqDataGrid("resize", size);
            },
            seek: function (where) {
                if (where === undefined) {
                    where = "";
                }
                $("#" + main_fun.id).yqDataGrid("seek", where);
            }
        }

    </script>
</body>

</html>